package com.atguigu.springcloud.service;

import com.atguigu.springcloud.commons.entities.Result;
import com.atguigu.springcloud.entities.Dept;
import com.atguigu.springcloud.fallback.DeptClientServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

/**
 * @author horay
 * @category Class description
 * @email horay_hyc@qq.com
 * @date 2018/6/11 22:44
 */
@FeignClient(value = "microservicecloud-dept", fallbackFactory = DeptClientServiceFallbackFactory.class)
public interface DeptService {

    @PostMapping("/dept")
    public Result add(Dept dept);

    @PutMapping("/dept")
    public Result edit(Dept dept);

    @DeleteMapping("/dept/{deptNo}")
    public Result delete(@PathVariable("deptNo") Long deptNo);

    @GetMapping("/dept/{deptNo}")
    public Result getByDeptNo(@PathVariable("deptNo") Long deptNo);

    @GetMapping("/dept")
    public Result findAll();

    @GetMapping("/discovery")
    public Result discovery();

}
